#ifndef FRIENDLISTVIEW_H
#define FRIENDLISTVIEW_H

#include <QListView>
#include <QObject>
#include <QPainter>
#include <QMouseEvent>
#include <QStyledItemDelegate>
#include <QStandardItemModel>

// 重写好友页面的ListView、QStyledItemDelegate、QSortFilterProxyModel类




// 重写好友页面的ListView
class FriendListView : public QListView
{
    Q_OBJECT
public:
    FriendListView(QWidget* parent = nullptr);

protected:
    // 实现左右键都可以选择
    void mousePressEvent(QMouseEvent* event) override;
};





// 重写好友页面的QStyledItemDelegate
// Qt::UserRole：1(头像)/2(昵称)/3(未读)/4(项的名字)
class FriendItemDelegate: public QStyledItemDelegate
{
    Q_OBJECT
public:
    FriendItemDelegate(QWidget* parent = nullptr);
    QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
    void paint(QPainter* painter,const QStyleOptionViewItem& option,const QModelIndex& index) const;
};

#endif // FRIENDLISTVIEW_H
